
var express = require('express');
var router = express.Router();

const musicians = require("../data/musicians")
// router.get('/', function (req, res, next) {
//   res.send('响应成功!')
// });

router.get('/all', function (req, res, next) {
	res.send({
		data: musicians
	})
})


router.get('/search', function (req, res, next) {
  name = req.query.name
  
  info = musicians.filter(ele => {
	  return ele['name'] === name
  })
  
  res.json({
	  "name": name,
	  "info": info
  })
});

module.exports = router;
